package fr.ensisa.sunspot.actor.server;

import fr.ensisa.sunspot.actor.AbstractActor;
import fr.ensisa.sunspot.actor.IActor;
import fr.ensisa.sunspot.automate.Automate;
import fr.ensisa.sunspot.automate.FactoryAutomate;
import fr.ensisa.sunspot.event.IEvent;

public class ButtonAutomateActor extends AbstractActor {
	private Automate automate;

	public ButtonAutomateActor() {
		super(IActor.KIND_FILTER);
		this.automate = FactoryAutomate.testAutomate();
	}

	@Override
	public int getID() {
		return 13;
	}

	@Override
	public int process(long timeStamp, IEvent event) {
		if (this.automate.process(event)) {
			setGeneratedEvents(this.automate.getOutgoingEvents());
			return IActor.RETURN_GETMYEVENTSANDDONTKILLME;
		} else {
			return IActor.RETURN_DONOTHING;
		}
	}

}
